import java.util.Stack;

public class Demo1 {
    public static void main(String[] args) {
        Stack<Integer> s = new Stack<>();
        s.push(12);
        s.push(23);
        s.push(34);
        s.push(45);

        int val = s.pop();          //相当于删除
        System.out.println(val);
        val = s.pop();
        System.out.println(val);

        int val2 = s.peek();       //只是获取，不删除
        System.out.println(val2);

        //判断栈是否为空，若为空则返回 true   ，若不为空则返回 false
        boolean empty = s.empty();
        System.out.println(empty);

    }
}
